<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <title></title>
    <link rel="stylesheet" type="text/css" th:href="@{/webjars/bootstrap/3.3.5/css/bootstrap-theme.min.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/webjars/bootstrap/3.3.5/css/bootstrap.min.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/bootstrap-datetimepicker.min.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/common.css}"/>
    <link rel="stylesheet" type="text/css" th:href="@{/css/logQuery.css}"/>
    <script type="text/javascript" th:src="@{/webjars/jquery/1.11.1/jquery.min.js}"></script>
    <script type="text/javascript" th:src="@{/webjars/bootstrap/3.3.5/js/bootstrap.min.js}"></script>
    <script type="text/javascript" th:src="@{/webjars/angularjs/1.5.5/angular.min.js}"></script>
    <script type="text/javascript" th:src="@{/webjars/angularjs/1.5.5/angular-resource.min.js}"></script>
    <script type="text/javascript" th:src="@{/js/common/bootstrap-datetimepicker.min.js}"></script>
    <script type="text/javascript" th:src="@{/js/common/jquery-ui-jqLoding.js}"></script>
    <script type="text/javascript" th:src="@{/js/common/bootbox.js}"></script>
    <script type="text/javascript" th:src="@{/js/common/Util.js}"></script>
    <script type="text/javascript" th:src="@{/js/common/PageUtil.js}"></script>
    <script type="text/javascript" th:src="@{/js/logQuery/LogQueryModule.js}"></script>
    <script type="text/javascript" th:src="@{/js/logQuery/LogQueryService.js}"></script>
    <script type="text/javascript" th:src="@{/js/logQuery/LogQueryController.js}"></script>
    <script type="text/javascript" th:src="@{/js/config/interceptor.js}"></script>
</head>
<body ng-app="app" ng-controller="logQueryCtrl" ng-init="init()">
<div class="div_content">
    <div class="log-query">
        <form class="form-inline" id="queryForm" name="queryForm">
            <label class="control-label">开始时间</label>
            <div class="form-group date" data-provide="datepicker">
                <input id="startTime" type="text" class="form-control datetimepicker" data-provide="datetimepicker-inline" autocomplete="off" ng-model="startTime" placeholder="开始时间"/>
            </div>

            <label class="control-label">结束时间</label>
            <div class="form-group date" data-provide="datepicker">
                <input  id="endTime" type="text" class="form-control datetimepicker" data-provide="datetimepicker-inline" autocomplete="off" ng-model="endTime" placeholder="结束时间"/>
            </div>

            <div class="form-group" >
                <label class="control-label">服务名</label>
                <select class="form-control" ng-model="serverName" ng-init="serverName=''">
                    <option value="">-</option>
                    <option value="BGS">BGS</option>
                    <option value="DATABASE">DATABASE</option>
                    <option value="MQ">MQ</option>
                    <option value="APP_UPLOAD">APP_UPLOAD</option>
                    <option value="AIR_INFO">AIR_INFO</option>
                    <option value="MSG_UP_CENTER">MSG_UP_CENTER</option>
                    <option value="WEBSITE">WEBSITE</option>
                </select>
            </div>

            <div class="form-group" >
                <label class="control-label">状态</label>
                <select class="form-control" ng-model="type" ng-init="type=''">
                    <option value="">-</option>
                    <option value="INFO">INFO</option>
                    <option value="WARN">WARN</option>
                    <option value="ERROR">ERROR</option>
                </select>
            </div>

            <div class="form-group" >
                <label class="control-label">关键字</label>
                <input type="text" class="form-control" ng-model="content"/>
            </div>
            <button class="btn btn-primary" ng-click="findLogs()">查询</button>
            <button class="btn btn-primary" ng-click="initParam()">清空</button>
        </form>
    </div>
    <div class="log-content">
        <table class="table table-bordered table-head">
            <thead>
            <th width="150px">状态</th>
            <th width="300px">时间</th>
            <th width="150px">服务名</th>
            <th>日志</th>
            </thead>
        </table>
        <div class="query-container">
            <table class="table table-bordered table-striped table-hover table-condensed">
                <tbody>
                <tr ng-repeat="log in serverLogs">
                    <td width="150px">
                        <div ng-if="log.type == 'INFO'">
                            <img data-placement="right" data-toggle="tooltip" th:src="@{/pic/log1.png}" />
                        </div>
                        <div ng-if="log.type == 'WARN'">
                            <img data-placement="right" data-toggle="tooltip" th:src="@{/pic/log2.png}" />
                        </div>
                        <div ng-if="log.type == 'ERROR'">
                            <img data-placement="right" data-toggle="tooltip" th:src="@{/pic/log3.png}" />
                        </div>
                    </td>
                    <td width="300px">{{log.createTime }}</td>
                    <td width="150px">{{log.name }}</td>
                    <td class="bubbling" data-toggle="tooltip" data-placement="top" title="{{log.content}}">{{log.content }}</td>
                </tr>
                </tbody>
            </table>
        </div>
        <nav class="form-inline pagination">
            <ul>
                <form id="pageForm" name="pageForm" class="form-inline" novalidate>
                    <span >第{{ selPage }}页/共{{ pages }}页</span>
                    <span >共{{ total }}条</span>
                    <button id="top" class="btn" ng-click="firstPage()" >首页</button>
                    <button id="previous" class="btn" ng-click="previous()" >上一页</button>
                    跳转到 <input class="form-control" ng-model = "page" required ng-pattern="/^[0-9]{1,9}$/"/> 页
                    <button id="go" class="btn" ng-click="selectCurrentPage(page)" ng-disabled="pageForm.$invalid">跳转</button>
                    <button id="next" class="btn" ng-click="next()" >下一页</button>
                    <button id="bottom" class="btn" ng-click="lastPage()" >尾页</button>
                    <select ng-model="selectPageSize" class="form-control"
                            ng-init="selectPageSize='25'"
                            ng-change="changePageSize(selectPageSize)">
                        <option value="25">25</option>
                        <option value="50">50</option>
                        <option value="100">100</option>
                    </select>
                </form>
            </ul>
        </nav>
    </div>

</div>
</body>
</html>